/**
 * 
 */
package com.attilax.sql;

import java.sql.Connection;
import java.sql.SQLException;

 
import com.attilax.ioc.IocFacV3_iocx_iocutil;
import com.attilax.order.RechargeOrderService;
import com.attilax.util.DateUtil;

/**
 * @author attilax 2016年10月24日 下午8:15:28
 */
public class TransTeset {

	/**
	 * attilax 2016年10月24日 下午8:15:28
	 * 
	 * @param args
	 * @throws SQLException
	 */
	public static void main(String[] args) throws SQLException {
		
	System.out.println(dateUtil_o16.class);	

		System.setProperty("cfgfile", "pay.ini");
		SqlExeService srv = IocFacV3_iocx_iocutil.getBean(SqlExeService.class);
		// srv.openTrans();
		Connection conn = srv.getConnection();
		conn.setAutoCommit(false);
		String sql = "update recharge set status=1 where orderid=123466";
		Object r = srv.executeUpdate(sql);

		try {
			if ("1".equals("1"))
				throw new RuntimeException("my ex");
			// 转账成功, 提交事务
			conn.commit();
		} catch (Exception e) {
			System.out.println("rooback trans");
			conn.rollback();
		}
		// srv.closeTrans();
		System.out.println(r);
		// conn.setAutoCommit(false);

	}

}
